package javabean;

public class ParseDouble {
	public double parseOnePoint(double d){
		long l = Math.round(d*10);   //四舍五入   
		d = l/10.0;	//取一位小数
		return d;
	}
	public double parsePercent(double dd){
		long l2 = Math.round(dd*1000);
		dd = l2/10.0;
		return dd;
	}
	public static String parseNullToStr(String str){
		String nStr = "";
		if(str!=null){
			nStr = str;
		}
		return nStr;
	}
	public static int countCompleX(long credit,long activity,long contribution,long favoriability){
		int c = 0 ;
		int active = (int)Math.sqrt(activity);
		//System.out.println(credit+" "+active+" "+contribution+" "+favoriability);
		c = (int) (0.5*credit+0.1*active+0.2*contribution+0.2*favoriability);
		if(c==0){
			c = 1;
		}
		return c;
	}
}
